package cn.edu.scau.cmi.huangzhiyuan.spring.client;

import org.springframework.context.ApplicationContext;


import cn.edu.scau.cmi.huangzhiyuan.spring.domain.Student;
import cn.edu.scau.cmi.huangzhiyuan.spring.domain.Teacher;
import cn.edu.scau.cmi.huangzhiyuan.spring.util.ApplicationContextUtil;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class Client extends Application{

	public static void main(String[] args) {
		launch(args);
	}

	@Override
	public void start(Stage primaryStage) throws Exception {
		ApplicationContext context = ApplicationContextUtil.getApplicationContext();
		Teacher teacher = (Teacher) context.getBean("liangzaoqing");
		Student student = (Student) context.getBean("yuan");
		
		VBox pane = new VBox();
		pane.getChildren().add(new Label(teacher.toString()));
		pane.getChildren().add(new Label(student.toString()));
		
		Scene scene = new Scene(pane);
		
		primaryStage.setScene(scene);
		primaryStage.setTitle("实验八-spring");
		primaryStage.setWidth(400);
		primaryStage.setHeight(300);
		primaryStage.show();
	}

}
